#ifndef __GGEAR_STREAM_H
#define __GGEAR_STREAM_H

#include "ggear_types.h"

namespace ggear
{
	namespace io
	{
		class Stream
		{
		protected:
			//! Default constructor
			Stream(){}

		public:
			//! Destructor
			virtual ~Stream(){}

			//! Read data from stream
			virtual u32 Read(u32 _size, u8* _dst){ return this->Read(_size, _dst); }

			//! Write data to stream
			virtual u32 Write(u32 _size, u8* _src){ return this->Write(_size, _src); }

			//! Set position in current stream
			virtual u32 Seek(u32 _offset, b8 _fromBeg = false){ return this->Seek(_offset, _fromBeg); }

			//! Return size of data stream
			virtual u32 Size(){ return this->Size(); }

			//! Return the read/write cursor of this stream
			virtual u32 Position(){ return this->Position(); }

			//! Close the data stream
			virtual void Close(){ this->Close(); }

			//! Read value from current file stream
			template<class _Tx>
			Stream& operator >> (_Tx& _out) { this->Read(sizeof(_Tx),(u8*) refs(_out)); return *this; }

			//! Write value into current file stream
			template<class _Tx>
			Stream& operator << (_Tx& _in) { this->Write(sizeof(_Tx),(u8*) refs(_in)); return *this; }
		};
	}
}
#endif